POV-Ray : Newsgroups : povray.beta-test : Calling a macro in layered texture : Re: Calling a macro in layered texture Server Time
4 Jul 2024 13:04:50 EDT (-0400)
  Re: Calling a macro in layered texture  
From: Alain
Date: 30 Jan 2010 19:25:40
Message: <4b64ce04$1@news.povray.org>

> Thorsten Froehlich<tho### [at] trfde>  wrote:>
>
>>> [Thomas wrote:]
>>> The following gives a parse error stating that it cannot find the closing
>>> pigment brace but finds a macro identifier instead:
>>>
>>> #declare MyTex =
>>> texture{ pigment{uv_mapping p_map16 }}
>>> texture{ pigment {color GammaColor(<0.83,0.83,0.83>,Gamma) transmit  0.17}}
>>>
>>
>> The question is: What does the macro return? A vector? - If so, that vector
>> is interpreted to be a 5-component vector (or extended accordingly). If a
>> vector is returned, the error message is correct
>> (http://www.povray.org/documentation/view/3.6.1/230/) because the transmit
>> would be a second color you are specifying, which is of course "unexpected".
>>
>
> I want to make sure I understand this myself. (I just re-read the "common color
> pitfalls" section of the docs, but don't quite know which part is applicable
> here.) Let's assume that Thomas's macro returns a simple 3-component vector.
> Would adding 'rgb' solve his problem?
>
> texture{ pigment {color rgb GammaColor(<0.83,0.83,0.83>,Gamma) transmit  0.17}}
>
> Ken
>
>
>
>
>
>
>

Not sure. I found that rgb<1,0.2,0.5,0.7> is treated as rgbf<1,0.2,0.5,0.7>.
That is, if you provide a 4 dimentions vector as a colour, the fourth 
component IS used as the filter value.

A 5 dimentions vector will also include a transmit value.
rgb<1,0.2,0.5,0.7,0.17> is treated as rgbft<1,0.2,0.5,0.7,0.17>.

Your sample would gives something like (Assuming Gamma =1):

texture{ pigment {color rgb<0.83, 0.83, 0.83, 0> transmit 0.17}}

or even this, if the macro is made to handle 5 dimentions colours:

texture{ pigment {color rgb<0.83, 0.83, 0.83, 0, 0> transmit 0.17}}

It would be safer to rewrite the macro ether as 3 macros (GammaColor3, 
GammaColor4 and GammaColor5) or a single macro with another parameter to 
sellect the number of dimention of the returned vector.



Alain


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.